import Vue from 'vue'

export default {
  beforeCreate () {
    let vmName = this.$route.name
    if (!vmName) {
      return
    }
    // 当组件初始化时，先触发一次，后续将不再调用
    this.$options.beforeEnter()
    const beforeEnter = vmName + 'BeforeEnter'
    Vue.$on(beforeEnter, this.$options.beforeEnter)
  },
  beforeEnter () {}
}
